from tensorflow.keras.models import load_model
import pandas as pd
import numpy as np

def predict_spec(filename, white_filename, h5_name):
    if(h5_name == ""):
        mod = load_model("mo1.h5")
    else:
        mod = load_model(h5_name)
    tmp = pd.read_csv(filename, sep='\t', header=None)
    w = pd.read_csv(white_filename, sep='\t', header=None)
    white = np.array(w[1])
    test = np.array(tmp[1])
    white = white[200:1100]
    test = test[200:1100]
    test = test / white * 0.97
    test = np.expand_dims(test, axis=0)
    result = mod.predict(test)
    return result